<div class="services view">
<?php echo $this->Html->link('Ver para Imprimir',array('controller'=>'services','action'=>'imprimir',$service['Service']['id']),array('class'=>'buttonSearch'));?>
<br/>
<br/>
<h2><?php  echo __('Servicio: %s',$service['Service']['numservicio']); ?></h2>
	<dl>
		
		<dt><?php echo __('Vehículo'); ?></dt>
		<dd>
			<?php echo $this->Html->link($service['Car']['marca'].' '.$service['Car']['modelo'], array('controller' => 'cars', 'action' => 'view',$service['Car']['id'])); ?>
			&nbsp;
		</dd>
		<dt><?php echo __('Número de Servicio'); ?></dt>
		<dd>
			<?php echo h($service['Service']['numservicio']); ?>
			&nbsp;
		</dd>
		<dt><?php echo __('Trabajo'); ?></dt>
		<dd>
			<?php echo h($service['Service']['descripcion']); ?>
			&nbsp;
		</dd>
		<dt><?php echo __('Fecha'); ?></dt>
		<dd>
			<?php echo h( h(date('d-m-Y', strtotime($service['Service']['fecha']))) ); ?>
			&nbsp;
		</dd>
		<dt><?php echo __('Kilometraje'); ?></dt>
		<dd>
			<?php echo h($service['Service']['kilometraje']); ?>
			&nbsp;
		</dd>
		<dt><?php echo __('Desgloce'); ?></dt>
		<dd>
			<table>
			<?php 
				$desgloce = explode(";",$service['Service']['desgloce'],-1);
				$numItems = count($desgloce);
				$total = 0;
				for ($i = 0; $i < $numItems; $i+=2) {
					$precio = floatval($desgloce[$i+1]);
					echo '<tr><td>'.$desgloce[$i].'</td><td style="text-align:right;">'.number_format($precio,0,',','.').'</td></tr>';
					$total += $precio;
				}
				echo '<tr><td><strong>TOTAL</strong></td><td style="text-align:right;"><strong>'.number_format($total,0,',','.').'</strong></td></tr>'
			?>
			</table>
			<?php //echo h($service['Service']['desgloce']); ?>
			&nbsp;
		</dd>
	</dl>
</div>
<div class="actions">
	<h3><?php echo __('Actions'); ?></h3>
	<ul>
		<li><?php echo $this->Html->link(__('Editar Servicio'), array('action' => 'edit', $service['Service']['id'])); ?> </li>
		<li><?php echo $this->Form->postLink(__('Borrar Servicio'), array('action' => 'delete', $service['Service']['id']), null, __('Are you sure you want to delete # %s?', $service['Service']['id'])); ?> </li>
		<li><?php echo $this->Html->link(__('Lista Vehículos'), array('controller' => 'cars', 'action' => 'index')); ?> </li>
		<li><?php  echo $this->Html->link('Volver',"javascript:history.back()"); ?> </li>
	</ul>
</div>
